﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TestCom : MonoBehaviour
{
    ComTrans com;
    public Text recvData;

    // Start is called before the first frame update
    void Start()
    {
        com = GetComponent<ComTrans>();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void OnClickSend() {
        //byte[] nb = new byte[5] { 0x55, 0xaa, 0xaa, 0xbb, 0xcc };
        //com.Send(nb);
        //byte[] datas = { 0x55, 0xaa, 0x02, 0x0a, 0x0d};
        byte[] datas = { 0x55, 0xaa, 0x01, 0x97 };
        com.Send(datas);
    }

    public void OnComDataRecv(string data) {
        Debug.Log("OnComDataRecv " + data);
        string txt = recvData.text;
        txt += "--" + data;
        recvData.text = txt;
    }

    public void OnClickClose() {
        Application.Quit();
    }

}
